/*
 * @Author: WangLong
 * @Date: 2023-05-04 09:03:20
 * @LastEditTime: 2023-05-08 14:31:35
 * @LastEditors: WangLong
 * @Description: 
 * @FilePath: \jnks-drone-company\src\utils\crypto2.js
 */
function getDAesString(encrypted, key, iv) {//解密
  var key = CryptoJS.enc.Utf8.parse(key);
  var iv = CryptoJS.enc.Utf8.parse(iv);
  var decrypted = CryptoJS.AES.decrypt(encrypted, key,
    {
      iv: iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    });
  var decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
  return decryptedStr.toString()
  // return decrypted.toString(CryptoJS.enc.Utf8);
}

function getDAes(data) {//解密
  var key = 'utryzbhdzsystem@';  //密钥
  var iv = 'utryzbhdzsystem@';
  var decryptedStr = getDAesString(data, key, iv);
  return decryptedStr;
}
export { getDAes };